Skip to content

Add PDF support for token counting#4

Open
Butanium wants to merge 1 commit intofreshfriedfish:mainfrom
Butanium:claude/implement-tokenizer-feature-011CUXZU1xLngA7ZqXa9aXNY
Open

Add PDF support for token counting#4
Butanium wants to merge 1 commit intofreshfriedfish:mainfrom
Butanium:claude/implement-tokenizer-feature-011CUXZU1xLngA7ZqXa9aXNY

Conversation

@Butanium
Copy link
Copy Markdown

  • Created /api/pdf route to handle PDF token counting using Anthropic's document content blocks
  • Updated tokenComponents.tsx to add PDF upload UI with file validation (32MB limit)
  • Added PDF-to-base64 conversion and API integration
  • Updated TokenMetrics component to display PDF token information
  • Supports PDFs up to 32MB and 100 pages as per Anthropic's API limits

Fixes #3

🤖 Generated with Claude Code

- Created /api/pdf route to handle PDF token counting using Anthropic's document content blocks
- Updated tokenComponents.tsx to add PDF upload UI with file validation (32MB limit)
- Added PDF-to-base64 conversion and API integration
- Updated TokenMetrics component to display PDF token information
- Supports PDFs up to 32MB and 100 pages as per Anthropic's API limits

Fixes freshfriedfish#3

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@Butanium
Copy link
Copy Markdown
Author

image this is vibe coded but tested

@Butanium Butanium marked this pull request as ready for review October 27, 2025 10:59
@Butanium
Copy link
Copy Markdown
Author

(solves #3 )

@Butanium Butanium mentioned this pull request Oct 27, 2025
@Butanium
Copy link
Copy Markdown
Author

@shaf-manzur any reason why you removed support for images? c2da9bf

@freshfriedfish
Copy link
Copy Markdown
Owner

Hi! Sorry for the delay, been a bit swamped IRL.

I've removed image support because I'd like this project to have a vibe similar to OpenAI's tokenizer.

There are already other projects which support image and PDF uploads.

I'd prefer to keep this project focused on just text.

@freshfriedfish
Copy link
Copy Markdown
Owner

Quick update on this: after thinking about it a bit more, I've changed my mind.

I'll be adding back image support and merging this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for PDFs?

3 participants